<?php include_once "top.php";
$where='city_id != 29';//city_id=29的为测试数据
$where.=trim($_GET['name'])?(' and name like "%' .trim($_GET['name']). '%" order by activate_time desc'):'';
?>
<div class="addleft">
	<a href="qr_code.php">查看二维码</a>
</div>
<div class="addbar">
	<ul>
	<h2 style="float:left">查看二维码</h2>
	<div style="float:left;margin:20px 0 0 20px">
		<form action="qr_code.php" method="get" onsubmit="return checkForm()">
		<input id="name" type="text" name="name" value="<?php echo $_GET['name']?>" class="ipt" placeholder="请输入门店名称" />
		<input type="submit" name="sub_sch" value="查找" />
		</form>
	</div>
	<?php if($_GET['name']){?>
	<li class="lihd"><strong align="center">
		<label style="width:150px">店铺ID</label>
		<label style="width:450px">店铺名称</label>
		<label>所属城市</label>
		<label>状态</label>
		<label>操作</label>
		</strong>
	</li>
	<?php 
	foreach($db->ig2_select('mae_shop',$where) as $list){
		$city=$db->ig2_want('mae_city','id='.$list['city_id']);
	?>
	<li align="center">
		<label style="width:150px"><?php echo $list['id']?></label>
		<label style="width:450px"><?php echo $list['name']?></label>
		<label><?php echo $city['name']?></label>
		<label><?php switch($list['is_activate']){
			case 0 : echo '未激活'; break;
			case 1 : echo '已激活'; break;
		}?></label>
		<label><a href="show.php?tid=<?php echo $list['tid']?>">查看二维码</a></label>
	</li>
	<?php }?>
	<li style="border:none"></li>
	<li style="border:none"><a href="shop_edit.php">添加店铺</a></li>
	<?php }?>
	</ul>
</div>
<script language="javascript">
function trim(str){
	return str.replace(/(^\s*)|(\s*$)/g, "");
}
function checkForm(){
	var name=trim($('#name').val());
	if(name == ''){
		alert('请输入门店名称');
		return false;
	}
	return true;
}
</script>
<?php include_once "down.php";?>